ostree_repo_copy_config
ostree_repo_get_parent
ostree_repo_write_config
+OstreeRepoTransactionStats
ostree_repo_prepare_transaction
ostree_repo_commit_transaction
-ostree_repo_commit_transaction_with_stats
ostree_repo_abort_transaction
ostree_repo_has_object
ostree_repo_write_metadata
{
if (OSTREE_OBJECT_TYPE_IS_META (objtype))
{
- self->txn_metadata_objects_written++;
+ self->txn_stats.metadata_objects_written++;
}
else
{
- self->txn_content_objects_written++;
- self->txn_content_bytes_written += file_object_length;
+ self->txn_stats.content_objects_written++;
+ self->txn_stats.content_bytes_written += file_object_length;
}
}
if (OSTREE_OBJECT_TYPE_IS_META (objtype))
- self->txn_metadata_objects_total++;
+ self->txn_stats.metadata_objects_total++;
else
- self->txn_content_objects_total++;
+ self->txn_stats.content_objects_total++;
g_mutex_unlock (&self->txn_stats_lock);
if (checksum)
else
ret_transaction_resume = FALSE;
- self->txn_metadata_objects_total =
- self->txn_metadata_objects_written =
- self->txn_content_objects_total =
- self->txn_content_objects_written =
- self->txn_content_bytes_written = 0;
+ memset (&self->txn_stats, 0, sizeof (OstreeRepoTransactionStats));
self->in_transaction = TRUE;
if (ret_transaction_resume)
}
gboolean
-ostree_repo_commit_transaction_with_stats (OstreeRepo *self,
- guint *out_metadata_objects_total,
- guint *out_metadata_objects_written,
- guint *out_content_objects_total,
- guint *out_content_objects_written,
- guint64 *out_content_bytes_written,
- GCancellable *cancellable,
- GError **error)
+ostree_repo_commit_transaction (OstreeRepo *self,
+ OstreeRepoTransactionStats *out_stats,
+ GCancellable *cancellable,
+ GError **error)
{
gboolean ret = FALSE;
if (!ot_gfile_ensure_unlinked (self->transaction_lock_path, cancellable, error))
goto out;
- if (out_metadata_objects_total) *out_metadata_objects_total = self->txn_metadata_objects_total;
- if (out_metadata_objects_written) *out_metadata_objects_written = self->txn_metadata_objects_written;
- if (out_content_objects_total) *out_content_objects_total = self->txn_content_objects_total;
- if (out_content_objects_written) *out_content_objects_written = self->txn_content_objects_written;
- if (out_content_bytes_written) *out_content_bytes_written = self->txn_content_bytes_written;
+ if (out_stats)
+ *out_stats = self->txn_stats;
ret = TRUE;
out:
return ret;
}
-gboolean
-ostree_repo_commit_transaction (OstreeRepo *self,
- GCancellable *cancellable,
- GError **error)
-{
- return ostree_repo_commit_transaction_with_stats (self, NULL, NULL, NULL, NULL, NULL,
- cancellable, error);
-}
-
gboolean
ostree_repo_abort_transaction (OstreeRepo *self,
GCancellable *cancellable,
G_DEFINE_BOXED_TYPE(OstreeRepoCommitModifier, ostree_repo_commit_modifier,
ostree_repo_commit_modifier_ref,
ostree_repo_commit_modifier_unref);
+
+static OstreeRepoTransactionStats *
+ostree_repo_transaction_stats_copy (OstreeRepoTransactionStats *stats)
+{
+ return g_memdup (stats, sizeof (OstreeRepoTransactionStats));
+}
+
+static void
+ostree_repo_transaction_stats_free (OstreeRepoTransactionStats *stats)
+{
+ return g_free (stats);
+}
+
+G_DEFINE_BOXED_TYPE(OstreeRepoTransactionStats, ostree_repo_transaction_stats,
+ ostree_repo_transaction_stats_copy,
+ ostree_repo_transaction_stats_free);
GFile *transaction_lock_path;
GMutex txn_stats_lock;
- guint txn_metadata_objects_total;
- guint txn_metadata_objects_written;
- guint txn_content_objects_total;
- guint txn_content_objects_written;
- guint64 txn_content_bytes_written;
+ OstreeRepoTransactionStats txn_stats;
GMutex cache_lock;
GPtrArray *cached_meta_indexes;
if (!run_mainloop_monitor_fetcher (pull_data))
goto out;
- if (!ostree_repo_commit_transaction (pull_data->repo, cancellable, error))
+ if (!ostree_repo_commit_transaction (pull_data->repo, NULL, cancellable, error))
goto out;
g_hash_table_iter_init (&hash_iter, updated_refs);
GKeyFile *new_config,
GError **error);
+/**
+ * OstreeRepoTransactionStats:
+ * @metadata_objects_total: The total number of metadata objects
+ * in the repository after this transaction has completed.
+ * @metadata_objects_written: The number of metadata objects that
+ * were written to the repository in this transaction.
+ * @content_objects_total: The total number of content objects
+ * in the repository after this transaction has completed.
+ * @content_objects_written: The number of content objects that
+ * were written to the repository in this transaction.
+ * @content_bytes_total: The amount of data added to the repository,
+ * in bytes, counting only content objects.
+ *
+ * A list of statistics for each transaction that may be
+ * interesting for reporting purposes.
+ */
+typedef struct _OstreeRepoTransactionStats OstreeRepoTransactionStats;
+
+struct _OstreeRepoTransactionStats {
+ guint metadata_objects_total;
+ guint metadata_objects_written;
+ guint content_objects_total;
+ guint content_objects_written;
+ guint64 content_bytes_written;
+
+ guint64 padding1;
+ guint64 padding2;
+ guint64 padding3;
+ guint64 padding4;
+};
+
+GType ostree_repo_transaction_stats_get_type (void);
+
gboolean ostree_repo_prepare_transaction (OstreeRepo *self,
gboolean enable_commit_hardlink_scan,
gboolean *out_transaction_resume,
GCancellable *cancellable,
GError **error);
-gboolean ostree_repo_commit_transaction (OstreeRepo *self,
- GCancellable *cancellable,
- GError **error);
-
-gboolean ostree_repo_commit_transaction_with_stats (OstreeRepo *self,
- guint *out_metadata_objects_total,
- guint *out_metadata_objects_written,
- guint *out_content_objects_total,
- guint *out_content_objects_written,
- guint64 *out_content_bytes_written,
- GCancellable *cancellable,
- GError **error);
+gboolean ostree_repo_commit_transaction (OstreeRepo *self,
+ OstreeRepoTransactionStats *out_stats,
+ GCancellable *cancellable,
+ GError **error);
gboolean ostree_repo_abort_transaction (OstreeRepo *self,
GCancellable *cancellable,
gboolean ret = FALSE;
gboolean skip_commit = FALSE;
gboolean in_transaction = FALSE;
- guint metadata_total = 0;
- guint metadata_written = 0;
- guint content_total = 0;
- guint content_written = 0;
- guint64 content_bytes_written = 0;
gs_unref_object GFile *arg = NULL;
gs_free char *parent = NULL;
gs_free char *commit_checksum = NULL;
gs_free char *parent_content_checksum = NULL;
gs_free char *parent_metadata_checksum = NULL;
OstreeRepoCommitModifier *modifier = NULL;
+ OstreeRepoTransactionStats stats;
context = g_option_context_new ("[ARG] - Commit a new revision");
g_option_context_add_main_entries (context, options, NULL);
&commit_checksum, cancellable, error))
goto out;
- if (!ostree_repo_commit_transaction_with_stats (repo,
- &metadata_total,
- &metadata_written,
- &content_total,
- &content_written,
- &content_bytes_written,
- cancellable, error))
+ if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error))
goto out;
in_transaction = FALSE;
if (opt_table_output)
{
g_print ("Commit: %s\n", commit_checksum);
- g_print ("Metadata Total: %u\n", metadata_total);
- g_print ("Metadata Written: %u\n", metadata_written);
- g_print ("Content Total: %u\n", content_total);
- g_print ("Content Written: %u\n", content_written);
- g_print ("Content Bytes Written: %" G_GUINT64_FORMAT "\n", content_bytes_written);
+ g_print ("Metadata Total: %u\n", stats.metadata_objects_total);
+ g_print ("Metadata Written: %u\n", stats.metadata_objects_written);
+ g_print ("Content Total: %u\n", stats.content_objects_total);
+ g_print ("Content Written: %u\n", stats.content_objects_written);
+ g_print ("Content Bytes Written: %" G_GUINT64_FORMAT "\n", stats.content_bytes_written);
}
else
{
gs_console_end_status_line (data->console, NULL, NULL);
}
- if (!ostree_repo_commit_transaction (data->dest_repo, NULL, error))
+ if (!ostree_repo_commit_transaction (data->dest_repo, NULL, NULL, error))
goto out;
g_print ("Writing %u refs\n", g_hash_table_size (refs_to_clone));